<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>模块信息配置</title>
		<%@include file="/WEB-INF/ibnms/common/jqgrid.jsp"%>
		<jsp:include page="/WEB-INF/ibnms/common/configinclude.jsp"></jsp:include>
		<%@ include file="/WEB-INF/ibnms/common/formValidation.jsp"%>
	</head>

<body>

	<div class="form-wrapper">
		<div class="form-title">
			<span class="ttcorner"></span>
			<h3>
				<span class="text">模块信息配置</span>
			</h3>
		</div>
		<div class="box-in">
			<form id="theForm" action="<s:url action="saveModule"/>">
				<input type="hidden" name="theForm.MODULE_LEVEL"	value="${theForm.MODULE_LEVEL}"></input>
				<input type="hidden" name="theForm.ISMP_JSP_COMMAND" value="${theForm.ISMP_JSP_COMMAND}"></input>
				<input type="hidden" id="theForm.PARENT_ID" name="theForm.PARENT_ID" value="${theForm.PARENT_ID}"></input>
				<input type="hidden" name="theForm.MODULE_ID" value="${theForm.MODULE_ID}"></input>

				<table id="moduleEditTab" border="0" cellspacing="0"
					cellpadding="0" class="table-03">
					<tr>
						<td class="monitor_bg1" height="13" align="right" nowrap>
							模块名称:
						</td>
						<td>
							<input type="text" name="theForm.MODULE_NAME" id="MODULE_NAME"
								class="validate[required]" value="${theForm.MODULE_NAME}"></input>
							<font color="red">*</font>
						</td>
					</tr>
					<tr>
						<td class="monitor_bg1" height="13" align="right" nowrap>
							模块路径：
						</td>
						<td>
							<input type="text" name="theForm.MODULE_PATH" id="MODULE_PATH" size=100
								value="${theForm.MODULE_PATH}"></input>
						</td>
					</tr>
					<tr>
						<td class="monitor_bg1" height="13" align="right" nowrap>
							链接打开方式：
						</td>
						<td>
							<select id="MODULE_TARGET" name="theForm.MODULE_TARGET" style="width:100px">
								<s:if
									test='%{theForm.MODULE_TARGET==null||theForm.MODULE_TARGET.equals("tab")}'>
									<option value="tab" selected="selected">
										tab
									</option>
									<option value="blank">
										弹出新窗口
									</option>
								</s:if>
								<s:else>
									<option value="tab">
										tab
									</option>
									<option value="blank" selected="selected">
										弹出新窗口
									</option>
								</s:else>
							</select>
							<font color="red">*</font>
						</td>
					</tr>
					<!-- 
					<tr style="display:none">
						<td class="monitor_bg1" height="13" align="right" nowrap>
							类型：
						</td>
						<td>
							<s:if test='%{theForm.PAGE_ELEMENT==null}'>
								<select id="ML_Type" name="theForm.ML_Type"
									onchange="check_page_Hidden();" style="width:70px">
									<option value="0" selected="selected">
										模块
									</option>
									<option value="1">
										页面元素
									</option>
								</select>
								<font color="red">*</font>
							</s:if>
							<s:if test='%{theForm.PAGE_ELEMENT!=null}'>
								<select id="ML_Type" name="theForm.ML_Type"
									onchange="check_page_Hidden();" style="width:70px">
									<option value="0">
										模块
									</option>
									<option value="1" selected="selected">
										页面元素
									</option>
								</select>
								<font color="red">*</font>
							</s:if>
						</td>
					</tr> -->
					<!-- 
					<tr style="display:none">
						<td class="monitor_bg1" height="13" align="right" nowrap>
							页面元素编号:
						</td>
						<td>
							<input type="text" name="theForm.PAGE_ELEMENT" id="PAGE_ELEMENT"
								class="validate[required]" value="${theForm.PAGE_ELEMENT}"></input>
								<font color="red">*</font>
						</td>
					</tr> -->
					<tr>
						<td class="monitor_bg1" height="13" align="right" nowrap>
							是否刷新：
						</td>
						<td>
							<select id="IS_REFRESH" name="theForm.IS_REFRESH" style="width:70px">
								<s:if
									test='%{theForm.IS_REFRESH==null||theForm.IS_REFRESH.equals("1")}'>
									<option value="0">
										不刷新
									</option>
									<option value="1" selected="selected">
										刷新
									</option>
								</s:if>
								<s:if test='%{theForm.IS_REFRESH.equals("0")}'>
									<option value="0" selected="selected">
										不刷新
									</option>
									<option value="1">
										刷新
									</option>
								</s:if>
							</select>
							<font color="red">*</font>
						</td>
					</tr>
					<!-- 
					<s:if test='%{theForm.PARENT_ID.equals("0")}'>
						<tr>
							<td class="monitor_bg1" height="13" align="right" nowrap>
								显示位置
							</td>
							<td>
								<select id="MODULE_LAYOUT" name="theForm.MODULE_LAYOUT" style="width:70px">
									<s:if test='%{theForm.MODULE_LAYOUT.equals("2")}'>
										<option value="1">
											正常
										</option>
										<option value="2" selected="selected">
											更多
										</option>
									</s:if>
									<s:else>
										<option value="1" selected="selected">
											正常
										</option>
										<option value="2" >
											更多
										</option>
									</s:else>
								</select>
							</td>
						</tr>
					</s:if>
					 -->
					<tr>
						<td class="monitor_bg1" height="13" align="right" nowrap>
							显示顺序：
						</td>
						<td>
							<input type="text" name="theForm.VIEW_ORDER" id="VIEW_ORDER"
								value="${theForm.VIEW_ORDER}"></input>
						</td>
					</tr>
					<tr>
						<td class="monitor_bg1" height="13" align="right" nowrap>
							生效：
						</td>
						<td>
							<select name="theForm.MODULE_ENABLE" style="width:70px" id="MODULE_ENABLE">
								<s:if
									test='%{theForm.MODULE_ENABLE==null||theForm.MODULE_ENABLE.equals("1")}'>
									<option value="1" selected="selected">
										有效
									</option>
									<option value="0"> 无效</option>
								</s:if>
								<s:if test='%{theForm.MODULE_ENABLE.equals("0")}'>
									<option value="1">
										有效
									</option>
									<option value="0" selected="selected">
										无效
									</option>
								</s:if>
							</select>
						</td>
					</tr>
					<tr>
						<td class="monitor_bg1" height="13" align="right" nowrap>
							单点登录方式：
						</td>
						<td>
							<select id="SSO_TYPE" name="theForm.SSO_TYPE" style="width:100px">
								<s:if
									test='%{theForm.SSO_TYPE==null||theForm.SSO_TYPE.equals("0")}'>
									<option value="0" selected="selected">
										正常
									</option>
									<option value="1">
										url参数
									</option>
								</s:if>
								<s:else>
									<option value="0">
										正常
									</option>
									<option value="1" selected="selected">
										url参数
									</option>
								</s:else>
							</select>
						</td>
					</tr>

				</table>
				<div class="block03">
					<input type="button" id="btn-save" class="btn-style02" value="保存" />
					&nbsp;&nbsp;
					<input type="button" class="btn-style02" value="重置"
						onclick="resetForm()" />
					&nbsp;&nbsp;
					<input type="button" class="btn-style02" value="返回"
						onclick="back()" />
				</div>
			</form>
		</div>
	</div>
</body>
	<script language="javascript">
		function back(){
			var parentId = $("input[name='theForm.PARENT_ID']").val();
			var level = $("input[name='theForm.MODULE_LEVEL']").val();
			window.location.href="<s:url action='loadListModules.do?theForm.PARENT_ID="+parentId+"&theForm.MODULE_LEVEL="+level+"' namespace='/'/>";
		}
		function resetForm(){
			$('#theForm')[0].reset();
		}
        $("#btn-save").click(function() {
        	/*var moduleId = $("input[name='theForm.MODULE_ID']").val();
        	$.ajax({
        		url:
        	});*/
			$("#theForm").submit();
		});
		
		$("#theForm").validationEngine().ajaxForm({
			type:"post",
			beforeSubmit:function() {
		        $("body").mask('正在保存,请稍后...');
			},
			success:function(data) {
				if (data == "true"){
					parent.refreshNode();
					back();
				} else {
					alert(data);
				}
			},
			error:function(xhr){
				$("body").unmask();
			   show_error(xhr);
			}
		});	
		
    </script>
</html>
